package cn.itsource.pet.service.impl;

import cn.itsource.basic.service.BaseServiceImpl;
import cn.itsource.basic.util.TreeUtil;
import cn.itsource.org.domain.Department;
import cn.itsource.pet.mapper.PetTypeMapper;
import cn.itsource.pet.pojo.domain.PetType;
import cn.itsource.pet.query.PetQuery;
import cn.itsource.pet.service.PetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
@Service
public class PetServiceimpl extends BaseServiceImpl<PetType, PetQuery> implements PetService {
    @Autowired
    private PetTypeMapper mapper;
//查找全部的宠物类型
    @Override
    public List<PetType> findAllPetType() {
        return mapper.findAllPetType();
    }
    //无限极树
    @Override
    public List<PetType> deptTree() {
        //1.查询所有的部门数据，作为递归的基础数据
        List<PetType> petTypes = mapper.deptTree();
        List<PetType> tree = TreeUtil.getTree(petTypes);
        return tree;
    }
}
